package com.ruoyi.erp.domain;

import java.util.Calendar;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 节假日管理对象 holiday_config
 * 
 * @author sauger
 * @date 2022-03-14
 */
public class HolidayConfig extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /**  */
    private Long id;

    /** 类型id */
    private Integer configTypeId;

    /** 类型名称 */
    private String configTypeTitle;

    /** 例外日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "例外日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date exceptDate;

    /** 例外类型 */
    @Excel(name = "例外类型")
    private Long dayType;


    /** 备注 */
    @Excel(name = "备注")
    private String description;

    /**
     * 虚拟字段，用于显示日期是星期几
     *
     */

    public String getWeekDay() {
        if (StringUtils.isNull(this.exceptDate)) return "/";
        String[] weekDays = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
        Calendar cal = Calendar.getInstance();
        cal.setTime(this.exceptDate);
        int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
        if (w < 0)
            w = 0;
        return weekDays[w];
    }

    public void setId(Long id)
    {
        this.id = id;
    }

    public Long getId() 
    {
        return id;
    }
    public void setExceptDate(Date exceptDate) 
    {
        this.exceptDate = exceptDate;
    }

    public Date getExceptDate() 
    {
        return exceptDate;
    }
    public void setDayType(Long dayType) 
    {
        this.dayType = dayType;
    }

    public Long getDayType() 
    {
        return dayType;
    }

    public void setDescription(String description) 
    {
        this.description = description;
    }

    public String getDescription() 
    {
        return description;
    }

    public Integer getConfigTypeId() {
        return configTypeId;
    }

    public void setConfigTypeId(Integer configTypeId) {
        this.configTypeId = configTypeId;
    }

    public String getConfigTypeTitle() {
        return configTypeTitle;
    }

    public void setConfigTypeTitle(String configTypeTitle) {
        this.configTypeTitle = configTypeTitle;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("configTypeId", getConfigTypeId())
            .append("configTypeTitle", getConfigTypeTitle())
            .append("exceptDate", getExceptDate())
            .append("dayType", getDayType())
            .append("description", getDescription())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .toString();
    }
}
